﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Registration.aspx.cs" Inherits="UserRegistrationForm.Registration" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <script src="Functions.js" type="text/javascript"></script>
    <title>Registration</title>
</head>
<body>
    <form id="mainForm" runat="server">
        Username:
        <asp:TextBox ID="UsernameTextBox" runat="server"></asp:TextBox>
        <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
             ControlToValidate="UsernameTextBox" Display="Dynamic" 
             ErrorMessage="This field is required!" ForeColor="Red">
         </asp:RequiredFieldValidator>
         <br />
        Password:
        <asp:TextBox ID="PasswordTextBox" runat="server" TextMode="Password"></asp:TextBox>
         <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
             ControlToValidate="PasswordTextBox" Display="Dynamic" 
             ErrorMessage="This field is required!" ForeColor="Red">
         </asp:RequiredFieldValidator>
         <br />
         Repeat password:
         <asp:TextBox ID="RepeatPasswordTextBox" runat="server" TextMode="Password"></asp:TextBox>
         <asp:RequiredFieldValidator ID="PasswordRequiredValidator" runat="server" 
             ControlToValidate="RepeatPasswordTextBox" Display="Dynamic" 
             ErrorMessage="This field is required!" ForeColor="Red">
         </asp:RequiredFieldValidator>
         <asp:CompareValidator ID="PasswordCompareValidator" runat="server" 
             ControlToCompare="PasswordTextBox" ControlToValidate="RepeatPasswordTextBox" 
             Display="Dynamic" EnableClientScript="True" 
             ErrorMessage="Password doesn't match!" ForeColor="Red">
        </asp:CompareValidator>
         <br />
         First name:
         <asp:TextBox ID="FirstNameTextBox" runat="server"></asp:TextBox>
        <br />
        Last name:
        <asp:TextBox ID="LastNameTextBox" runat="server"></asp:TextBox>
        <br />
        Age:
        <asp:TextBox ID="AgeTextBox" runat="server"></asp:TextBox>
        <asp:RangeValidator ID="AgeRangeValidator" runat="server" ControlToValidate="AgeTextBox"
        MinimumValue="18" MaximumValue="81" ErrorMessage="Your age must be between 18 and 81"
        Display="Dynamic" ForeColor="Red">
        </asp:RangeValidator>
         <br />
        E-mail:
         <asp:TextBox ID="EmailTextBox" runat="server"></asp:TextBox>
         <asp:RegularExpressionValidator ID="EmailValidator" runat="server" 
             ControlToValidate="EmailTextBox" Display="Dynamic" 
             ErrorMessage="Please, use a valid e-mail address." ForeColor="Red" 
             ValidationExpression="[a-zA-Z][a-zA-Z0-9\-\.]*[a-zA-Z]@[a-zA-Z][a-zA-Z0-9\-\.]+[a-zA-Z]+\.[a-zA-Z]{2,4}">
        </asp:RegularExpressionValidator>
        <br />
        Local address:
        <asp:TextBox ID="LocalAddressTextBox" runat="server"></asp:TextBox>
        <br />
        Phone:
        <asp:TextBox ID="PhoneTextBox" runat="server"></asp:TextBox>
        <asp:RegularExpressionValidator
            id="PhoneValidator" runat="server" ControlToValidate="PhoneTextBox"
            ValidationExpression= "(\d{3,4})(\-(\d{3,4}))+" ForeColor="Red"
            ErrorMessage="Phone number is not formatted correctly!" Display="Dynamic">
        </asp:RegularExpressionValidator>
         <br />
        <asp:CheckBox ID="AcceptCheckBox" runat="server" />
        I accept!<br />
        <asp:CustomValidator ID="CheckedSubmitValidator" runat="server"
        ClientValidationFunction="evaluateSubmitAbility(this)" 
        ErrorMessage="Please, accept!" Text="Error!" EnableClientScript="True" >
        </asp:CustomValidator>
        <asp:Button ID="SubmitButton" runat="server" Text="Submit" />
        <br />
        <asp:ValidationSummary ID="ValidationSummary" runat="server" />
    </form>
</body>
</html>

